{% extends "admin/admin.html" %}

{% block css %}
    <style>
        #auth_list .col-md-12,#auth_list .col-md-2{
            padding:0px;
        }
    </style>
{% endblock %}

{% block content %}
    <!--内容-->
    <section class="content-header">
        <h1>微图分享管理系统</h1>
        <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i> 角色管理</a></li>
            <li class="active">编辑角色</li>
        </ol>
    </section>
    <section class="content" id="showcontent">
        <div class="row">
            <div class="col-md-12">
                <div class="box box-primary">
                    <div class="box-header with-border">
                        <h3 class="box-title">编辑角色</h3>
                    </div>
                    <form role="form" method="post">
                        <div class="box-body">

                             {% for msg in get_flashed_messages(category_filter=["ok"]) %}
                                <div class="alert alert-success alert-dismissible">
                                    <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×
                                    </button>
                                    <h4><i class="icon fa fa-check"></i> 操作成功</h4>
                                    {{ msg }}
                                </div>
                            {% endfor %}

                            {% for msg in get_flashed_messages(category_filter=["err"]) %}
                                <div class="alert alert-danger alert-dismissible">
                                    <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×
                                    </button>
                                    <h4><i class="icon fa fa-ban"></i> 操作失败</h4>
                                    {{ msg }}
                                </div>
                            {% endfor %}


                            <div class="form-group">
                                <label for="input_name">{{ form.name.label }}</label>
                              <!--  <input type="text" class="form-control" id="input_name" placeholder="请输入角色名称！"> -->
                                {{ form.name(value=role.name) }}
                                {% for err in form.name.errors %}
                                    <div class="col-md-12">
                                        <p style="color:red">{{ err }}</p>
                                    </div>
                                {% endfor %}
                            </div>
                            <div class="form-group" id="auth_list">
                                <div class="col-md-12">
                                    <label>{{ form.auths.label }}</label>
                                </div>
                                <div class="col-md-2">
                                    <label>
                                        <!--   <input type="checkbox" name="input_url"> 添加标签 -->
                                        {{ form.auths }}
                                        {% for err in form.auths.errors %}
                                            <div class="col-md-12">
                                                <p style="color:red">{{ err }}</p>
                                            </div>
                                        {% endfor %}
                                    </label>
                                </div>
                            </div>
                        </div>
                        <div class="box-footer">
                           <!-- <button type="submit" class="btn btn-primary">添加</button> -->
                            {{ form.csrf_token }}
                            {{ form.submit }}
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </section>
    <!--内容-->
{% endblock %}

{% block js %}
    <script>
    $(document).read(function () {
         $("#g-10").addClass("active");
         $("#g-10-1").addClass("active");
    });
    </script>
{% endblock %}